<template>
	<view class="Menu">
		<!-- 导航条 :style="{ height: $wanlshop.wanlsys().height + 'px' }"-->
		<view class="cu-custom">
			<view class="cu-bar fixed" style="background: #06224b; color: #fff;"
				:style="{height: $wanlshop.wanlsys().height + 'px',paddingTop: $wanlshop.wanlsys().top + 'px',}">
				<view class="action">
					<text class="wlIcon-fanhui1" style="margin-left: 0" @tap="$wanlshop.back(1)"></text>
				</view>
				<view class="content" :style="{ top: $wanlshop.wanlsys().top + 'px' }">
					易联宝理财专区
				</view>
				<view class="action" @tap="$wanlshop.auth('/pages/manage/order?id='+list.id)">
					{{$t('otcTransaction.but.my-order')}}
				</view>
			</view>
		</view>
		<view style="position: fixed;height: auto;  width: auto; top: 0; left: 0; bottom: 0; right: 0;"
			:style="{top: $wanlshop.wanlsys().height + 'px',}">

			<view class="yldList">
				<view>YLD数量：<h3>{{list.money}}</h3>
				</view>
				<view>合约时间：<span>{{list.endtime}}</span></view>
				<view>预计月化收益YLD：<span>{{list.rate+'%'}}</span></view>
				<view class="btn" @tap="$wanlshop.auth('/pages/manage/details?id='+list.id)">查看产品详情</view>
			</view>

		</view>
		<view class="yldfot">
			<view class="yldfotL">YLD数量:{{list.money}}</view>
			<view class="yldfotR" @click="financing(list.id)">交易</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				id: '',
				list: {},
				ap_Yld: ''
			};
		},
		onLoad(option) {
			this.id = option.id
			this.init()
		},
		onShow() {
			this.init()
		},
		methods: {
			init() {
				uni.request({
					url: "/financing/financingEdit",
					method: 'POST',
					data: {
						financing_id: this.id,
					},
					success: (res) => {
						if (res.res.code == 1) {
							this.list = res.res.data.data
							this.ap_Yld = res.res.data.ap_Yld
						}
					},
				});
			},
			financing(val) {
				uni.request({
					url: "/financing/financingAdd",
					method: 'POST',
					data: {
						financing_id: val,
					},
					success: (res) => {
						if (res.res.code == 1) {
							this.$wanlshop.msg(res.res.msg)
						}
					},
				});
			}
		}
	};
</script>

<style lang="scss">
	page {
		background: #06224b;
	}

	.Menu {
		.yldList {
			margin: 24rpx 24rpx 16rpx 24rpx;
			background: rgba(255, 255, 255, 0.1);
			border-radius: 16rpx;
			padding: 30rpx 30rpx 30rpx 30rpx;
			font-size: 28rpx;

			uni-view {
				color: rgba(255, 255, 255, 0.6);
				margin-bottom: 20rpx;

				h3 {
					display: inline-block;
					font-size: 32rpx;
					color: #51E7FC;
				}

				span {
					color: #FFFFFF;
				}
			}

			.btn {
				padding: 10rpx 0;
				font-size: 28rpx;
				color: #51E7FC;
				border-radius: 4rpx;
				border: 2rpx solid #51E7FC;
				max-width: 234rpx;
				text-align: center;
			}

		}

		.yldfot {
			position: absolute;
			bottom: 68rpx;
			left: 24rpx;
			right: 24rpx;
			font-size: 28rpx;
			color: #82F0FF;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.yldfotR {
				width: 264rpx;
				height: 80rpx;
				line-height: 80rpx;
				text-align: center;
				color: #012751;
				background: #82F0FF;
				border-radius: 4rpx;
			}
		}
	}
</style>